<template>
  <div class="lastProfits votesOwn">
    <div class="details">
      <el-table
        :data="tableData"
        style="width: 100%"
        class="table">
        <!-- 挖矿方式 -->
        <el-table-column
          prop="name"
          :label="$t('newpos.miningMethod')">
        </el-table-column>
        <!-- 对应数量（EOS） -->
        <el-table-column
          prop="number"
          :label="`${$t('newpos.correspondingQuantity')}（EOS）`">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { toFixed } from '@/utils/validate';

export default {
  name: 'votesOwn', // 您的挖矿总量
  data() {
    return {
      tableData: []
    }
  },
  components: {},
  props: {
    votesOwnVisible: {
      type: Boolean,
      default: false
    },
    pool: Object
  },
  watch: {
    votesOwnVisible: function change(val) {
      if (val) {
        this.handlePoolInfo()
      }
    },
  },
  computed: {},
  created() {},
  mounted() {
    this.handlePoolInfo()
  },
  beforeDestroy() {},
  methods: {
    handlePoolInfo() {
      this.tableData = [];
      const val = this.pool;
      const item = [
        {
          name: this.$t('newpos.buyRex'),
          number: val.rexCount ? toFixed(val.rexCount, 4) : '0.0000',
        },
        {
          name: this.$t('newpos.stakedCpuNet'),
          number: val.stakeCount ? toFixed(val.stakeCount, 4) : '0.0000',
        }
      ]
      this.tableData.push(...item)
    }
  },
}
</script>
<style lang="scss" scoped>
@import '@/views/newpos/public.scss';
</style>

